package zjitc.servlet;

import zjitc.domain.User;
import zjitc.service.UserService;
import zjitc.service.UserServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/delSelectedServlet")
public class DelSelectedServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取数据
        String[] uids = request.getParameterValues("uid");
        //调用service方法
        UserService service = new UserServiceImpl();
        service.delSelected(uids);
        //进行重定向
        response.sendRedirect(request.getContextPath()+"/userListServlet");
    }
}
